<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Create a filtered iterator from another iterator</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="callbackfilteriterator.accept.html">« CallbackFilterIterator::accept</a></li>
      <li style="float: right;"><a href="class.directoryiterator.html">DirectoryIterator »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.callbackfilteriterator.html">CallbackFilterIterator</a></li>
    <li>Create a filtered iterator from another iterator</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="callbackfilteriterator.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">CallbackFilterIterator::__construct</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.4.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">CallbackFilterIterator::__construct</span> &mdash; <span class="dc-title">Create a filtered iterator from another iterator</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-callbackfilteriterator.construct-description">
  <h3 class="title">说明</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>CallbackFilterIterator::__construct</strong></span>(<span class="methodparam"><span class="type"><a href="class.iterator.html" class="type Iterator">Iterator</a></span> <code class="parameter">$iterator</code></span>, <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>)</div>

  <p class="para rdfs-comment">
   Creates a filtered iterator using the <code class="parameter">callback</code> to 
   determine which items are accepted or rejected.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-callbackfilteriterator.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">iterator</code></dt>

    <dd>

     <p class="para">
      The iterator to be filtered.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">callback</code></dt>

    <dd>

     <p class="para">
      The callback, which should return <strong><code>true</code></strong> to accept the current item
      or <strong><code>false</code></strong> otherwise.
      See <a href="class.callbackfilteriterator.html#callbackfilteriterator.examples" class="link">Examples</a>.
     </p>
     <p class="para">
      May be any valid <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> value.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 seealso" id="refsect1-callbackfilteriterator.construct-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><a href="class.callbackfilteriterator.html#callbackfilteriterator.examples" class="link">CallbackFilterIterator Examples</a></li>
    <li class="member"><span class="methodname"><a href="callbackfilteriterator.accept.html" class="methodname" rel="rdfs-seeAlso">CallbackFilterIterator::accept()</a> - Calls the callback with the current value, the current key and the inner iterator as arguments</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>